home *** CD-ROM | disk | FTP | other *** search
/ PC Direct 1998 August / PC Direct August 1998.iso / S / powerj / Product / hpp.z / WBRUSH.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-25  |  4.7 KB  |  164 lines

  1. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2.    %     Copyright (C) 1994, by WATCOM International Inc.  All rights    %
  3.    %     reserved.  No part of this software may be reproduced or        %
  4.    %     used in any form or by any means - graphic, electronic or       %
  5.    %     mechanical, including photocopying, recording, taping or        %
  6.    %     information storage and retrieval systems - except with the     %
  7.    %     written permission of WATCOM International Inc.                 %
  8.    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. */
  10.  
  11. /*************************************************************************
  12.  *
  13.  * WBrush -- Wrapper for the Windows 95 Brush object.
  14.  *
  15.  *************************************************************************/
  16.  
  17. #ifndef _WBRUSH_HPP_INCLUDED
  18. #define _WBRUSH_HPP_INCLUDED
  19. #pragma once
  20.  
  21. #ifndef _WNO_PRAGMA_PUSH
  22. #pragma pack(push,8);
  23. #pragma enum int;
  24. #endif
  25.  
  26. #ifndef _WBITMAP_HPP_INCLUDED
  27. #  include "wbitmap.hpp"
  28. #endif
  29. #ifndef _WCOLOR_HPP_INCLUDED
  30. #  include "wcolor.hpp"
  31. #endif
  32.  
  33. enum WBrushPattern {
  34.     WBPatternSolid = -1,
  35.     WBPatternHorizontal,
  36.     WBPatternVertical,
  37.     WBPatternFDiagonal,
  38.     WBPatternBDiagonal,
  39.     WBPatternCross,
  40.     WBPatternDiagCross
  41. };
  42.  
  43. enum WBStockBrush {
  44.     WBWhiteBrush = 0,
  45.     WBLightGrayBrush = 1,
  46.     WBGrayBrush = 2,
  47.     WBDarkGrayBrush = 3,
  48.     WBBlackBrush = 4,
  49.     WBInvisibleBrush = 5
  50. };
  51.  
  52. class WBrushReference;
  53.  
  54. class WCMCLASS WBrush : public WObject {
  55.     WDeclareSubclass( WBrush, WObject );
  56.  
  57.     public:
  58.  
  59.         /**********************************************************
  60.          * Constructors and Destructors
  61.          *********************************************************/
  62.  
  63.         WBrush();
  64.         WBrush( WBStockBrush brush );
  65.         WBrush( const WColor & color, WBrushPattern pattern=WBPatternSolid );
  66.         WBrush( const WBitmap & bmp );
  67.         WBrush( const WBrush & brush );
  68.         WBrush( const WBrushHandle handle, WBool deleteHandle=FALSE );
  69.     
  70.         ~WBrush();
  71.     
  72.         /**********************************************************
  73.          * Properties
  74.          *********************************************************/
  75.  
  76.         // Handle
  77.  
  78.         WBrushHandle GetHandle() const;
  79.  
  80.         /**********************************************************
  81.          * Methods
  82.          *********************************************************/
  83.  
  84.         // Clear
  85.  
  86.         WBool Clear();
  87.  
  88.         // Create
  89.  
  90.         WBool Create( WBStockBrush brush );
  91.         WBool Create( const WColor & color, WBrushPattern p=WBPatternSolid );
  92.         WBool Create( const WBitmap & bitmap );
  93.         WBool Create( const WBrush & brush );
  94.         WBool Create( const WBrushHandle handle, WBool deleteHandle=FALSE );
  95.  
  96.         /**********************************************************
  97.          * Static Methods
  98.          *********************************************************/
  99.  
  100.         // IsValidHandle
  101.         //
  102.         //     Returns TRUE if the given handle is valid.  Can
  103.         //     optionally specify whether or not a null handle
  104.         //     is "valid".
  105.  
  106.         static WBool IsValidHandle( WBrushHandle handle,
  107.                                     WBool nullValid=FALSE );
  108.  
  109.         // ResetSystemBrushes
  110.  
  111.         static void ResetSystemBrushes();
  112.  
  113.         /**********************************************************
  114.          * Static Properties
  115.          *********************************************************/
  116.  
  117.         // BlackBrush
  118.  
  119.         static const WBrush & GetBlackBrush();
  120.  
  121.         // InvisibleBrush
  122.  
  123.         static const WBrush & GetInvisibleBrush(); // NOT the same as null brush
  124.  
  125.         // NullBrush
  126.  
  127.         static const WBrush & GetNullBrush();
  128.  
  129.         // WhiteBrush
  130.  
  131.         static const WBrush & GetWhiteBrush();
  132.  
  133.         /**********************************************************
  134.          * Others
  135.          *********************************************************/
  136.  
  137.         WBrush & operator=( const WBrush & b );
  138.         WBrush & operator=( WBStockBrush b );
  139.  
  140.         int operator==( const WBrush &b ) const;
  141.         int operator!=( const WBrush &b ) const;
  142.  
  143.         /**********************************************************
  144.          * Data Members
  145.          *********************************************************/
  146.  
  147.     private:
  148.  
  149.         WBrushReference *       _brushRef;
  150. };
  151.  
  152. #ifdef _DEBUG
  153. #define W_ISBRUSHHANDLE(h) CHECKGDI(WBrush::IsValidHandle((WBrushHandle)h))
  154. #else
  155. #define W_ISBRUSHHANDLE(h)
  156. #endif
  157.  
  158. #ifndef _WNO_PRAGMA_PUSH
  159. #pragma enum pop;
  160. #pragma pack(pop);
  161. #endif
  162.  
  163. #endif // _WBRUSH_HPP_INCLUDED
  164.